var dinamicSearch = {
    
    init: function(){
        dinamicSearch.cliSearch();
        dinamicSearch.carSearch();
    },
    
    cliSearch: function(){
        var parkCli = document.getElementBy('parkCliInput').getAttribute(name);
            
        $(document).ready(function(){
            new Autocomplete(parkCli, function() {
                    this.setValue = function(cpf,idcli) {
                            $("#parkCpfResInput").val(cpf);
                            $("#parkCliId").val(idcli); 
                    }
                    if ( this.isModified ){
                            this.setValue("");
                    }
                    if ( this.value.length < 1 && this.isNotClick ){
                            return ;
                    }
                    return "autoCompleteCli.php?q=" + this.value;
            });

        });
    },
    
    carSearch:function(){
        $(document).ready(function(){
            new Autocomplete("parkCar", function() {
                    this.setValue = function(model,color,year,idcar) {
                            $("#parkModelInput").val(model);
                            $("#parkColorInput").val(color);
                            $("#parkYearInput").val(year);
                            $("#parkCarId").val(idcar);
                    }
                    if ( this.isModified ){
                            this.setValue("");
                    }
                    if ( this.value.length < 1 && this.isNotClick ){
                            return ;
                    }
                    return "autoCompleteCar.php?q=" + this.value;
            });

        });
    }
};

dinamicSearch.init();